<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/admin/common/inc/incSession.jsp" %>
<jsp:include page="/admin/common/inc/Top.jsp" />
<%
	
	String srchCond 	= util.getStr(request.getParameter("srchCond")); 
	String srchContent 	= util.getStr(request.getParameter("srchContent"));
	String srchStdt 	= util.getStr(request.getParameter("srchStdt"));
	String srchEndt 	= util.getStr(request.getParameter("srchEndt"));
	String srchUseYn 	= util.getStr(request.getParameter("srchUseYn"));


	// paging
	String perRow 		= util.getStr(request.getParameter("perRow"));
	String startRow 	= util.getStr(request.getParameter("startRow"));
	String currentPage 	= util.getStr(request.getParameter("currentPage"));
	
	perRow = "".equals(perRow) ?"10":perRow;
	startRow = "".equals(startRow)?"0":startRow;
	currentPage = "".equals(currentPage)?"1":currentPage;
	
	
	param.put("srchCond",srchCond);
	param.put("srchContent",srchContent);
	param.put("srchStdt",srchStdt);
	param.put("srchEndt",srchEndt);
	param.put("srchUseYn",srchUseYn);
	
	// paging
	param.put("perRow", perRow);
	param.put("startRow", startRow);
	
	
	System.out.println("map : " + param);
	
	
	//param.put("startRow",11);
	//param.put("perRow",10);
	
	ArrayList rs =	(ArrayList)sqlMap.queryForList("AdminMember.selectMemberList",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
	
	HashMap map	 = 	(HashMap)sqlMap.queryForObject("AdminMember.selectMemberListTotal",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
	
%>
<script type="text/javascript">
	// 리스트 갯수
	var dispCnt = '${dispCnt}';
	
	$(document).ready(function() {

		createCalendar();
		
	    // 달력 토글
		$('#calToggle').bind('click', function(event){
			
				$('#dhtmlxDblCalendar').toggle();
		});
		//	초기값 셋팅
		$("#srchCond").val("<%=srchCond%>");
		$("#srchContent").val("<%=srchContent%>");
		$("#srchStdt").val("<%=srchStdt%>");
		$("#srchEndt").val("<%=srchEndt%>");
		$("#srchUseYn").val("<%=srchUseYn%>");
		$("#startRow").val("<%=startRow%>");
		$("#currentPage").val("<%=currentPage%>");
		
		
		
		//	검색
		$("#btnSearch").click(function() {
			
			$("#listForm").attr("action","/admin/member/memberList.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();
			
		});
		
		//	검색
		jQuery("a[name^='goPage']").click(function(){
			
			$("#startRow").val($(this).attr("startRow"));
			$("#currentPage").val($(this).attr("currentPage"));
			$("#listForm").attr("action","/admin/member/memberList.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();
			
		});
		
		
		//	초기화
		$("#btnReset").click(function() {
			
			$("input[type=text]").val("");
			
		});
		
		// 상세
	    jQuery("a[name^='detailAnc']").click(function(){
	    	
	    	$('#memberId').val($(this).attr("memberId"));
	    	$("#listForm").attr("action","/admin/member/memberDetail.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();

	    });
		
	});
		
</script>	
	<body>
		<!-- header -->
		<div id="header">
			<jsp:include page="/admin/common/inc/Header.jsp" />
		</div>
		<!-- //header -->
		
		<!-- wrap -->
		<div id="wrap">
		
			<!-- contentWrap -->
			<div id="contentWrap">
			
				<!-- topmenu -->
				<jsp:include page="/admin/common/inc/TopMenu.jsp" />
				<!-- //topmenu -->
				
				
				<div id="conts">
				
					<div class="main_view clfix">
						<!-- content -->
						
						
						<form id="listForm" name="listForm" method="post">
						<input type="hidden" name="memberId" id="memberId" value="" />
						<input type="hidden" name="startRow" id="startRow" value="" />
						<input type="hidden" name="currentPage" id="currentPage" value="" />
						
						<div class="section_main" style="height: 700px;">
							
							
							<!--board input-->
							<table class="bdc_input mb10">
								<colgroup><col width="20%"><col width="32%"><col width="20%"><col width="28%"></colgroup>
								<tr>
									<th class="cth">검색조건</th>
									<td class="ctd" colspan="3">
										<select id="srchCond" name="srchCond">
											<option value="">선택</option>
											<option value="MEMBER_NAME">성명</option>
											<option value="NICKNAME">닉네임</option>
											<option value="EMAIL">이메일</option>
										</select>
										<input type="text" class="txt" style="width:150px;" id="srchContent" name="srchContent" value="">
									</td>
								</tr>
								<tr>
									<th class="cth">가입일자</th>
									<td class="ctd">
										<input id="srchStdt" name="srchStdt" type="text" class="txt" style="width: 60px;" readonly="true" value=""/> ~ 
							   	   		<input id="srchEndt" name="srchEndt" type="text" class="txt" style="width: 60px;" readonly="true" value=""/>
							   			<img name="calToggle" id="calToggle" src ="/common/calendar/imgs/icon_minicalendar.gif" style="cursor: pointer;"/>
									    <div id="dhtmlxDblCalendar" style="position: absolute;"></div>
									</td>
									<th class="cth">사용여부</th>
									<td class="ctd">
										<select id="srchUseYn" name="srchUseYn">
											<option value="">전체</option>
											<option value="Y">Y</option>
											<option value="N">N</option>
										</select>
									</td>
								</tr>
							</table>
							<!--//board input-->
							
							
							<!--btn-->
							<div class=" al_center ">
								<button type="button" id="btnSearch">조회</button>
								<button type="button" id="btnReset">초기화</button>
							</div>
							<!--//btn-->
							<!--btn-->
<!-- 							<div class="al_right mb10"> -->
<!-- 								<button type="button" id="btnCreate">등록</button> -->
<!-- 								<button type="button" id="btnModify">수정</button> -->
<!-- 								<button type="button" id="btnDelete">삭제</button> -->
<!-- 							</div> -->
							<!--//btn-->
						
						
							<!--board list-->
							<div class="board_list mt10">
								<table style="table-layout:fixed">
									<thead>
										<tr>
											<th width="20">No</th>
											<th width="50">프로필사진</th>
											<th width="100">성명</th>
											<th width="100">닉네임</th>
											<th width="200">이메일</th>
											<th width="200">아이디</th>
											<th width="70">사용여부</th>
											<th width="70">가입일</th>
										</tr>
									</thead>
									<tbody id="prodList" name="prodList">
									<%
										for( int i = 0 ; i < rs.size() ; i++){
									%>
							            <tr>
							                <td><%=util.getStr(((HashMap)rs.get(i)).get("rm")) %></td>
							                <td><img src="<%=util.getStr(((HashMap)rs.get(i)).get("MEMBER_IMG")) %>" onerror="this.src='/common/images/no_prof_img.jpg'" style="width: 30px; height: 30px;" /></td>
							                <td><%=util.getStr(((HashMap)rs.get(i)).get("MEMBER_NAME")) %></td>
											<td><%=util.getStr(((HashMap)rs.get(i)).get("NICKNAME")) %></td></td>
											<td title="<%=util.getStr(((HashMap)rs.get(i)).get("EMAIL")) %>" style="text-overflow:ellipsis; overflow:hidden; white-space:nowrap;"><%=util.getStr(((HashMap)rs.get(i)).get("EMAIL")) %></td>
											<td title="<%=util.getStr(((HashMap)rs.get(i)).get("MEMBER_ID")) %>" style="text-overflow:ellipsis; overflow:hidden; white-space:nowrap;"><a href="javascript:void(0)" name="detailAnc" memberId="<%=((HashMap)rs.get(i)).get("MEMBER_ID") %>"><%=util.getStr(((HashMap)rs.get(i)).get("MEMBER_ID")) %></a></td></td>
											<td><%=util.getStr(((HashMap)rs.get(i)).get("")) %></td></td>
											<td><%=util.getStr(((HashMap)rs.get(i)).get("REG_DATE")) %></td></td>
							            </tr>
									<%		
										}
									%>
									<%
										if( 0 >= rs.size()){
									%>							            
						            	<tr class="nodata">
						                     <td align="center" colspan="8">조회된 Data 가 없습니다.</td>
						                </tr>
									<%
										}
									%>							            
									</tbody>
								</table>
							</div>
							<!--//board list-->
							
						
						</div>
						
						<!--//board list-->						
						<div class="section_main" style="height: 45px;">
							<%@ include file="/common/inc/paging.jsp" %>
						</div>
						</form>
						
						<!-- //content -->
						
					</div>
					
				</div>
				
			</div>
			<!-- //contentWrap -->
			
		</div>
		
		<div id="footer" style="background: url('/layoutSample/footer.png') no-repeat; height: 150px;">
		</div>
		
		<!-- //wrap -->
		
		
	
	</body>
</html>